<!DOCTYPE html>
<html lang="en">
   <head>
      <title>Forge Issue 428 Test</title>
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
      <script type="text/javascript" src="/forge/forge.js"></script>
      <script type="text/javascript" src="/support/task.js"></script>
      <script type="text/javascript" src="issue-428.js"></script>

      <link type="text/css" rel="stylesheet" media="all" href="/tests.css" />
      <style type="text/css">
         .ready { color: inherit; background: inherit; }
         .testing { color: black; background: yellow; }
         .pass{ color: white; background: green; }
         .fail{ color: white; background: red; }
      </style>
   </head>
<body>
<div class="nav">
   <a href="..">Forge Tests</a> /
   <a href=".">Issues</a> /
   Issue 428
</div>

<div class="header">
   <h1>Issue 428 Tests</h1>
</div>

<div class="content">

<fieldset class="section">
   <ul>
      <li><a href="https://github.com/digitalbazaar/forge/issues/428">Issue 428</a></li>
      <li>As of Oct 28, 2016, a Safari 10.0.1 bug causes bit twiddling math failures.</li>
      <li>Behavior is that after a while a section of deterministic code starts to fail and stays failing. For instance, the SHA-1 hash of a constant input.</li>
      <li>Likely cause is a hot loop is getting improperly optimized. Opening the console causes code to function properly. Observing critical code via saving values or logging can cause code to function properly.</li>
      <li>PBKDF tests can fail due to use of the hashing functions.</li>
      <li><strong>Note</strong>: Due to the nature of this bug, once it is triggered a page refresh is required to test again.</li>
      <li>See JavaScript console for more detailed output.</li>
   </ul>
</fieldset>

<fieldset class="section">
<legend>Control</legend>
   <button id="start">Start</button>
   <button id="stop">Stop</button>
   <button id="reset">Reset</button>
   <button id="reload" onclick="location.reload()">Reload Page</button>
   <br/>
   HASH:
   <input id="do_hash_md5" type="checkbox" checked="checked"/>MD5 |
   <input id="do_hash_sha1" type="checkbox" checked="checked"/>SHA-1 |
   <input id="do_hash_sha256" type="checkbox" checked="checked"/>SHA-256 |
   <input id="do_hash_sha384" type="checkbox" checked="checked"/>SHA-384 |
   <input id="do_hash_sha512" type="checkbox" checked="checked"/>SHA-512<br/>
   PBKDF2:
   <input id="do_pbkdf2_md5" type="checkbox"/>MD5 |
   <input id="do_pbkdf2_sha1" type="checkbox" checked="checked"/>SHA-1 |
   <input id="do_pbkdf2_sha256" type="checkbox" checked="checked"/>SHA-256 |
   <input id="do_pbkdf2_sha384" type="checkbox"/>SHA-384 (slow) |
   <input id="do_pbkdf2_sha512" type="checkbox"/>SHA-512 (slow)<br/>
   <input id="hash_updates" value="10000"/> # of hash updates<br/>
   <input id="pbkdf2_rounds" value="10000"/> # of pbkdf2 rounds<br/>
   AES ENCRYPT:
   <input id="do_encrypt_AES-CBC" type="checkbox" checked="checked"/>AES-CBC |
   <input id="do_encrypt_AES-CFB" type="checkbox"/>AES-CFB |
   <input id="do_encrypt_AES-OFB" type="checkbox"/>AES-OFB |
   <input id="do_encrypt_AES-CTR" type="checkbox"/>AES-CTR |
   <input id="do_encrypt_AES-GCM" type="checkbox"/>AES-GCM<br/>
   <input id="encryptions" value="100"/> # of aes encryptions<br/>
   AES DECRYPT:
   <input id="do_decrypt_AES-CBC" type="checkbox" checked="checked"/>AES-CBC |
   <input id="do_decrypt_AES-CFB" type="checkbox"/>AES-CFB |
   <input id="do_decrypt_AES-OFB" type="checkbox"/>AES-OFB |
   <input id="do_decrypt_AES-CTR" type="checkbox"/>AES-CTR |
   <input id="do_decrypt_AES-GCM" type="checkbox"/>AES-GCM<br/>
   <input id="decryptions" value="100"/> # of aes decryptions<br/>
</fieldset>

<fieldset class="section">
<legend>Progress</legend>
Status: <span id="status">?</span><br/>
Pass: <span id="pass">?</span>/<span id="total">?</span><br/>
Fail: <span id="fail">?</span>
</fieldset>

<fieldset class="section">
<legend>Tests</legend>
<div id="tests"></div>
</fieldset>

</div>

</body>
</html>
